#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by Kumikoda on 2017/6/17

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

import MySQLdb
from redis.client import Redis
from modules import confs


# mysql connection
def db_connect():
    try:
        conn = MySQLdb.connect(**confs.db_info)
        cur = conn.cursor()
        return conn, cur
    except Exception as e:
        raise e

# redis connection
def redis_connect():
    try:
        redis_conn = Redis(**confs.redis_info)
        return redis_conn
    except Exception as e:
        raise e



